<template>
    <div class="box">
      <span class="el-input" style="margin-top: 20px">
        年份：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <el-input-number v-model="year" controls-position="right" @change="handleChange" :min="2020" :max="2024" class="yearw1"></el-input-number>
      </span>
  
      <div style="margin-left: 400px; margin-top: -35px; font-size: 13px">
        发布状态
        <el-select v-model="selectedStatus" placeholder="选择发布状态" @change="handleStatusChange">
          <el-option label="待审核" value="pending-review"></el-option>
          <el-option label="待提交" value="pending-submission"></el-option>
          <el-option label="审核通过" value="approved"></el-option>
        </el-select>
      </div>
  
      <div style="margin-top: 30px">
        <el-button type="primary" plain icon="el-icon-question" size="mini" style="margin-left: 10px" @click="tiaozhuan">预审核</el-button>
        <el-button type="primary" plain icon="el-icon-circle-plus" size="mini" style="margin-left: 40px">发布</el-button>
        <el-button type="info" plain icon="el-icon-close" size="mini" style="margin-left: 40px">撤回</el-button>
        <el-button type="danger" icon="el-icon-delete" plain size="mini" style="margin-left: 40px">删除</el-button>
        <el-button type="warning" plain icon="el-icon-download" size="mini" style="margin-left: 40px">导出</el-button>
      </div>
  
      <!--列表-->
      <el-table border :data="list" style="width: 96%; margin-top: 20px;" :row-class-name="tableRowClassName">
        <!-- 定义表格列 -->
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column align="center" prop="accessorys" label="考核对象" width="180"></el-table-column>
        <el-table-column align="center" prop="markss" label="申诉原因" width="285"></el-table-column>
        <el-table-column align="center" prop="Applicationscore" label="申诉分值"></el-table-column>
        <el-table-column align="center" prop="auditopinion_preaudit" label="预审核意见" width="180"></el-table-column>
        <el-table-column align="center" prop="score_audit" label="审核分值"></el-table-column>
        <el-table-column align="center" prop="state_preaudit" label="预审核状态" width="180"></el-table-column>
        <el-table-column align="center" prop="state_publish" label="发布状态" width="180"></el-table-column>
      </el-table>
    </div>
  </template>
  
  <script>
  import { getjiafenshen } from "../../../api/zhenfu/audit";
  
  export default {
    data() {
      return {
        list: [], // 这是用来存储从后端获取的数据
        year: 2024,
        selectedStatus: ''
      };
    },
    created() {
      this.fetchData();
    },
    methods: {
      async fetchData() {
        try {
          const response = await getjiafenshen();
          if (response && response.data) {
            this.list = response; // 假设后端的返回数据在 data 字段里
          }
        } catch (error) {
          console.error('Error fetching data:', error);
          // 可以显示一个用户友好的错误提示
        }
      },
      handleChange(value) {
        // 处理年份变更逻辑
      },
      handleStatusChange(value) {
        // 处理状态变更逻辑
      },
      tiaozhuan() {
        // 处理预审核按钮点击逻辑
      }
    }
  };
  </script>
  
  <style scoped>
  .box {
    margin-left: 30px;
    margin-top: 20px;
  }
  </style>
  